<template>
  <div class="classify">
    <div>分类管理</div>
    <div>乐居分类:</div>
    <div class="box-cards">
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span>创意</span>
          <el-button style="float: right; padding: 3px 0" type="text"
            >操作按钮</el-button
          >
        </div>
        <div class="text item">
          <img
            src="	https://bufan-apitown.oss-cn-beijing.aliyuncs.com/bftec/20230331164347215main-active.png"
            alt=""
            style="width: 283px; height: 300px"
          />
        </div>
      </el-card>
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span>创意</span>
          <el-button style="float: right; padding: 3px 0" type="text"
            >操作按钮</el-button
          >
        </div>
        <div class="text item">
          <img
            src="	https://bufan-apitown.oss-cn-beijing.aliyuncs.com/bftec/20230331164308975cinema-active.png"
            alt=""
            style="width: 283px; height: 300px"
          />
        </div>
      </el-card>
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span>创意</span>
          <el-button style="float: right; padding: 3px 0" type="text"
            >操作按钮</el-button
          >
        </div>
        <div class="text item">
          <img
            src="https://bufan-apitown.oss-cn-beijing.aliyuncs.com/bftec/20201113162219971zhuangshipin.png"
            alt=""
            style="width: 283px; height: 300px"
          />
        </div>
      </el-card>
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span>创意</span>
          <el-button style="float: right; padding: 3px 0" type="text"
            >操作按钮</el-button
          >
        </div>
        <div class="text item">
          <img
            src="https://bufan-apitown.oss-cn-beijing.aliyuncs.com/bftec/20201118165103745dengju.png"
            alt=""
            style="width: 283px; height: 300px"
          />
        </div>
      </el-card>
    </div>
    <div>全部分类：</div>
    <el-table :data="homeInfo" style="width: 100%">
      <el-table-column type="expand">
        <template slot-scope="scope">
          <el-form label-position="left" inline class="demo-table-expand">
            <el-form-item
              v-for="item in scope.row.children"
              :key="item.id"
              style="width: 100%"
              class="nvnry"
            >
              <div>{{ item.name }}</div>
              <div>
                <img
                  :src="item.icon"
                  alt=""
                  style="width: 100px; height: 100px"
                />
              </div>
              <div>{{ item.name }}</div>
              <div>{{ item.sort }}</div>
              <div v-if="item.navStatus == 1">显示</div>
              <div v-else>不显示</div>
              <div v-if="item.showStatus == 1">展示</div>
              <div v-else>不展示</div>
              <div>{{ item.description }}</div>
              <div>{{ item.createTime }}</div>
            </el-form-item>
          </el-form>
        </template>
      </el-table-column>
      <el-table-column prop="province" label="菜单名称" align="center">
        <template slot-scope="scope">
          {{ scope.row.category.keywords }}
        </template>
      </el-table-column>
      <el-table-column prop="province" label="icon" align="center">
        <template slot-scope="scope">
          <img
            style="width: 100px; height: 100px"
            :src="scope.row.icon"
            alt=""
          />
        </template>
      </el-table-column>
      <el-table-column prop="province" label="分类名字" align="center">
        <template slot-scope="scope">
          {{ scope.row.category.keywords }}
        </template>
      </el-table-column>
      <el-table-column prop="province" label="排序" align="center">
        <template slot-scope="scope">
          {{ scope.row.category.sort }}
        </template>
      </el-table-column>

      <el-table-column prop="province" label="显示状态" align="center">
        <template slot-scope="scope">
          <div v-if="scope.row.category.navStatus == 1">显示</div>
          <div v-else>不显示</div>
        </template>
      </el-table-column>
      <el-table-column prop="province" label="导航栏展示" align="center">
        <template slot-scope="scope">
          <div v-if="scope.row.category.showStatus == 1">展示</div>
          <div v-else>不展示</div>
        </template>
      </el-table-column>

      <el-table-column prop="province" label="描述" align="center">
        <template slot-scope="scope">
          {{ scope.row.category.description }}
        </template>
      </el-table-column>
      <el-table-column prop="province" label="创建时间" align="center">
        <template slot-scope="scope">
          {{ scope.row.category.createTime }}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import product from '@/api/product.js'
export default {
  data() {
    return {
      homeInfo: [],
    }
  },
  created() {},
  mounted() {
    this.getAllCategoryApi()
  },
  methods: {
    getAllCategoryApi() {
      product.getAllCategoryApi().then(res => {
        console.log(res, 'res')
        this.homeInfo = res.data.items
        // new Object(this.homeInfo)
        console.log('this.homeInfo=====', this.homeInfo)
      })
    },
  },
}
</script>

<style scoped lang="scss">
.classify {
  margin: 30px;
}

.demo-table-expand {
  font-size: 0;
  width: 100% !important;
}
.demo-table-expand label {
  width: 90px;
  color: #99a9bf;
}
.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 100%;
}

.nvnry {
  div {
    width: 198px;
    float: left;
    text-align: center;
  }
}
.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: '';
}
.clearfix:after {
  clear: both;
}

.box-card {
  width: 380px;
  height: 370px;
}
.box-cards {
  display: flex;
  justify-content: space-evenly;
}
</style>